<template>
  <div class="contentWrapper wpx1200" id="contentWrapper">
    <el-card class="box-card mt20">
		  <div slot="header" class="clearfix">
		    <span>检测记录</span>
		    <span class="floatr cursor lan" @click="download">下载</span>
		  </div>
		  <div class="clearFix">
		  	<el-table
		      :data="tableData"
	        v-loading="loading"
		      style="width: 100%">
		      <el-table-column label="序号" width="100">
					  <template slot-scope="scope">
					    {{scope.row.taskId}}
					  </template>
					</el-table-column>
		      <el-table-column
		        label="详细信息"
		        width="880">
		        <template slot-scope="scope">
		        	<p class="clearFix">
		        		<div class="floatl w10 scbold">
		        			检测链接：
		        		</div>
		        		<div class="floatl w90">
		        			<a :href="scope.row.taskUrl" target="_blank" class="cblue">{{scope.row.taskUrl}}</a>
		        		</div>
		        	</p>
		        	<p class="clearFix">
		        		<div class="floatl w10 scbold">
		        			截图链接：
		        		</div>
		        		<div class="floatl w90">
		        		  <a :href="'http://47.106.160.27/sysfile/'+scope.row.sourceImg" target="_blank" class="cblue">{{scope.row.checkImg}}</a>
		        		</div>
		        	</p>
		        	<p class="clearFix">
		        		<div class="floatl w10 scbold">
		        			关键词：
		        		</div>
		        		<div class="floatl w90">
		        			{{scope.row.wordList}}
		        		</div>
		        	</p>
					   	<p class="clearFix">
		        		<div class="floatl w10 scbold">
		        			前后摘要：
		        		</div>
		        		<div class="floatl w90">
		        			{{scope.row.checkResult}}
		        		</div>
		        	</p>
					  </template>
		      </el-table-column>
		     
		      <el-table-column label="操作">
			      <template slot-scope="scope">
			        <el-button type="danger" @click="modifystatus(scope.row.checkId)" v-show="scope.row.status==1">点击处理</el-button>
			        <el-button type="success" v-show="scope.row.status==0">已处理</el-button>
			      </template>
			    </el-table-column>
		    </el-table>
		  </div>
		</el-card>
  </div>
</template>

<script>
import MsgBus from '@/components/bus.js';
import API from "@/api"
export default {
  name: 'setting',
  data () {
    return {
    	list: [],
    	 tableData: [],
    	 loading: true,
    	 id:'',
    	 wordList:"",
//  	 done: false
    }
  },
  mounted: function () {
  	if(location.href.indexOf("?") != -1){
  		this.id = location.href.split("?")[1]
  	}else{
  		this.$router.push({
				      name: '/',
				    })
  	}
  	setMinHeight("contentWrapper")
  		$(window).resize(function() {
		  setMinHeight("contentWrapper")
		});
  	this.getList()
//	this.wordList = sessionStorage.getItem("recordUrlWordList") || sessionStorage.getItem("urlWordList")
  	this.wordList = sessionStorage.getItem("urlWordList");
  },
//beforeDestroy: function(){
//	sessionStorage.removeItem('recordUrlWordList');
//	sessionStorage.removeItem('urlWordList');
//},
   methods: {
		download(){
			if(this.tableData.length==0){
				this.$message.error("暂无数据")
				return false;
			}
  		API.check.download(API.header.getCookie("token"),"poi/downexcel/" + this.id).then(({data}) => {
       		window.open("http://47.106.160.27/sysfile/" + data,'_blank');
      })
  	},
   	modifystatus(id){
   		var mess = {
	  		token:API.header.getCookie("token"),
	  		id:id
	  	}
	  	API.record.modifystatus(mess).then(({data}) => {
	       if(data.code=='0'){
	       		this.getList()
	       }else{
						this.$message.error(data.msg);
	       }
      })
   	},
	  getList(){
	  	var mess = {
	  		token:API.header.getCookie("token"),
	  		id:this.id
	  	}
	  	API.record.getDetail(mess).then(({data}) => {
	  			this.loading = false
	       if(data.code=='0'){
						this.tableData = data.data;
	       }else{
						this.$message.error(data.msg);
	       }
      })
	  },
	  handleEdit(data){
	  	alert(data)
	  },
	  toDetail(data) {
	    sessionStorage.setItem("setdata",JSON.stringify(data))
	  	this.$router.push({
	      name: 'settingDetail',
	    })
	  }
	}
  
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
	#app {
		/*text-align: left;*/
	}
	.smallCard {
		 width: 260px;
    margin: 13px;
    float: left;

	}
	div.jiu {
		height: 105px;
	}
	.add{
		font-size: 70px;
    text-align: center;
    line-height: 105px;
    cursor: pointer;
	}
	.add span {
	    position: relative;
    	top: -10px;
	}
	.el-icon-edit {
		margin-left: 160px;
		cursor: pointer;
	}
	.el-icon-edit:before {
    content: "\E61C";
    color: #000;
	}
</style>
